<template>
  <div>
    <div class="basicInfo">
      <div class="topTitle">
        <div class="leftPic">
          <img src="@/assets/common/组 33.png" alt="" />
        </div>
        <div class="rightTitle">{{ companyDetail.name }}</div>
        <div class="addBtn" @click="openCompany">
          <el-link type="primary">信息编辑</el-link>
        </div>
      </div>
      <div class="basicItem">
        <div class="itemInfo">
          <div class="itemContent">
            主要负责人：{{ companyDetail.legalPerson }}
          </div>
          <div class="itemContent">
            建筑数量:{{ companyDetail.buildingNum }}
          </div>
          <div class="itemContent">
            专职安全管理人员:{{ companyDetail.safeManagementPerson }}人
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">联系电话:{{ companyDetail.phone }}</div>
          <div class="itemContent">
            特种作业人员:{{ companyDetail.specialOperationPerson }}人
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">
            社会统一信用代码:{{ companyDetail.creditCode }}
          </div>
          <div class="itemContent">
            微型消防站:{{ companyDetail.fireStation }}
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">
            建筑面积:{{ companyDetail.buildingArea }}方
          </div>
          <div class="itemContent">园区地址:{{ companyDetail.address }}</div>
        </div>
      </div>
    </div>
    <div class="problemBox">
      <div class="problemTitle">园区重大隐患</div>
      <div class="problemList">
        <div class="problemItem">
          <div class="problemItemDetail">
            <div class="dot"></div>
            <div class="label">隐患总数:</div>
            <div class="value">{{ changeNum.totalNum }}</div>
          </div>
          <img src="@/assets/common/椭圆 50.png" alt="" />
        </div>
        <div class="problemItem problemItem2">
          <div class="problemItemDetail">
            <div class="dot"></div>
            <div class="label">已整改数:</div>
            <div class="value">{{ changeNum.changeTwo }}</div>
          </div>
          <img src="@/assets/common/椭圆 50.png" alt="" />
        </div>
        <div class="problemItem problemItem4">
          <div class="problemItemDetail">
            <div class="dot"></div>
            <div class="label">一般隐患数:</div>
            <div class="value">{{ changeNum.gradeOne }}</div>
          </div>
          <img src="@/assets/common/椭圆 50.png" alt="" />
        </div>
        <div class="problemItem problemItem3">
          <div class="problemItemDetail">
            <div class="dot"></div>
            <div class="label">重大隐患数:</div>
            <div class="value">{{ changeNum.gradeTwo }}</div>
          </div>
          <img src="@/assets/common/椭圆 50.png" alt="" />
        </div>
      </div>
    </div>
    <div class="companyInfoBox">
      <div class="companyInfoTitle">园区企业汇总信息</div>
      <div class="basicItem">
        <div class="itemInfo">
          <div class="itemContent">
            企业数量：{{ companyInfo.enterpriseTotal }}家
          </div>
          <div class="itemContent">
            安全责任状：{{ companyInfo.safeManagementProtocolNum }}人
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">
            承租总面积：{{ companyInfo.leaseAreaTotal }}方
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">
            安全管理协议：{{ companyInfo.safeResponsibilityStatementTotal }}份
          </div>
        </div>
        <div class="itemInfo">
          <div class="itemContent">
            企业员工总数：{{ companyInfo.enterprisePeoTotal }}人
          </div>
        </div>
      </div>
    </div>
    <addIndustryInfo
      :addDialog.sync="addDialog"
      ref="addIndustryInfoRef"
    ></addIndustryInfo>
  </div>
</template>

<script>
import { getParkDangerNumApi, getEnterpriseTatolApi } from "@/api/industryInfo";
import addIndustryInfo from "./components/addIndustryInfo";

import { companyDetail } from "@/api/industryInfo";

export default {
  name: "",
  props: {},
  components: {
    addIndustryInfo,
  },
  data() {
    return {
      changeNum: {},
      companyInfo: {},
      addIndustryInfoRef: null,
      addDialog: false,
      companyDetail: {},
    };
  },
  created() {
    this.getParkDangerNum();
    this.getEnterpriseTatol();
    this.getCompanyDetail();
  },
  methods: {
    async getParkDangerNum() {
      const res = await getParkDangerNumApi();
      this.changeNum = res.data;
    },
    async getEnterpriseTatol() {
      const res = await getEnterpriseTatolApi();
      this.companyInfo = res.data;
    },
    openCompany() {
      this.addDialog = true;
      this.$refs.addIndustryInfoRef.getCompanyDetail();
    },
    async getCompanyDetail() {
      const res = await companyDetail({ id: 1 });
      this.companyDetail = res.data;
    },
  },

  mounted() {},
  watch: {},
  computed: {},
  filters: {},
};
</script>

<style scoped lang="scss">
.basicInfo {
  background-color: #fff;
  margin-bottom: 16px;
  padding: 24px;
  position: relative;
  .addBtn {
    position: absolute;
    top: 20px;
    right: 40px;
    .el-link.el-link--primary {
      font-size: 16px;
    }
  }
  .topTitle {
    display: flex;
    // align-items: center;
    font-weight: bold;
    font-size: 24px;
    color: #313235;
    .leftPic {
      text-align: center;
      vertical-align: top;
      img {
        width: 32px;
        height: 32px;
        margin-right: 16px;
        display: inline-block;
      }
    }
  }
  .basicItem {
    color: #525459;
    padding: 0 60px;
    display: flex;
    justify-content: space-between;
    .itemInfo {
      .itemContent {
        margin: 24px 0;
      }
    }
  }
}
.problemBox {
  background-color: #fff;
  margin-bottom: 16px;
  padding: 16px 24px;
  .problemTitle {
    font-weight: bold;
    position: relative;
    padding-left: 8px;
    margin-bottom: 24px;
  }
  .problemTitle::before {
    content: "";
    display: block;
    width: 4px; /* 竖条的宽度 */
    height: 18px; /* 竖条的高度 */
    background-color: #0077ff; /* 竖条的颜色 */
    position: absolute;
    left: 0;
    transform: translateY(-50%); /* 向上移动自身高度的50% */
    top: 50%;
    border-radius: 2px 2px 2px 2px;
  }
}
.problemList {
  display: flex;
  justify-content: space-between;
  .problemItem {
    width: 23%;
    height: 96px;
    line-height: 96px;
    text-align: center;
    background: linear-gradient(135deg, #fff6f2 0%, #f2faff 0%, #e1ebfc 100%);
    position: relative;
    color: #2e6ecc;
    font-size: 18px;
    img {
      width: 80px;
      height: 80px;
      position: absolute;
      right: 0;
      bottom: 0;
    }
    .problemItemDetail {
      display: flex;
      align-items: center;
      justify-content: center;
      .dot {
        width: 10px;
        height: 10px;
        background-color: #4ca0ff;
        border-radius: 50%;
        margin-right: 16px;
      }
      .value {
        font-weight: bold;
        font-size: 32px;
        color: #2e6ecc;
        margin-left: 20px;
      }
    }
  }

  .problemItem2 {
    background: linear-gradient(135deg, #f0fdef 0%, #dffaed 100%);
    color: #2cc06d;
    font-size: 18px;
    .problemItemDetail {
      display: flex;
      align-items: center;
      justify-content: center;
      .dot {
        width: 10px;
        height: 10px;
        background-color: #18e571;
        border-radius: 50%;
        margin-right: 16px;
      }
      .value {
        font-weight: bold;
        font-size: 32px;
        color: #2cc06d;
        margin-left: 20px;
      }
    }
  }
  .problemItem3 {
    background: linear-gradient(135deg, #fff3f1 0%, #ffe3e7 100%);
    color: #f03a49;
    font-size: 18px;
    .problemItemDetail {
      display: flex;
      align-items: center;
      justify-content: center;
      .dot {
        width: 10px;
        height: 10px;
        background-color: #ca2432;
        border-radius: 50%;
        margin-right: 16px;
      }
      .value {
        font-weight: bold;
        font-size: 32px;
        color: #ca2432;
        margin-left: 20px;
      }
    }
  }
  .problemItem4 {
    background: linear-gradient(135deg, #fff6f2 0%, #fce9e1 100%);
    color: #e35c2b;
    font-size: 18px;
    .problemItemDetail {
      display: flex;
      align-items: center;
      justify-content: center;
      .dot {
        width: 10px;
        height: 10px;
        background-color: #ff895e;
        border-radius: 50%;
        margin-right: 16px;
      }
      .value {
        font-weight: bold;
        font-size: 32px;
        color: #e35c2b;
        margin-left: 20px;
      }
    }
  }
}

.companyInfoBox {
  background-color: #fff;
  margin-bottom: 16px;
  padding: 16px 24px;
  .companyInfoTitle {
    font-weight: bold;
    position: relative;
    padding-left: 8px;
  }
  .companyInfoTitle::before {
    content: "";
    display: block;
    width: 4px; /* 竖条的宽度 */
    height: 18px; /* 竖条的高度 */
    background-color: #0077ff; /* 竖条的颜色 */
    position: absolute;
    left: 0;
    transform: translateY(-50%); /* 向上移动自身高度的50% */
    top: 50%;
    border-radius: 2px 2px 2px 2px;
  }
  .basicItem {
    color: #525459;
    padding: 0 60px;
    display: flex;
    justify-content: space-between;
    .itemInfo {
      .itemContent {
        margin: 24px 0;
      }
    }
  }
}
</style>
